<layout name='Layout/layout_main' />
<script type="text/javascript" src="__PUBLIC__/editor/kindeditor.js"></script>
<script type="text/javascript" src="__PUBLIC__/editor/kindeditor.setting.js"></script>
<script type="text/javascript">
	// 加载编辑器
	function save(step) {
		$("#confirm").val("");
		$("#confirm_wrap  span").each(function() {
			$("#confirm").val($("#confirm").val() + $(this).attr("emp_no") + '|');
		})
		$("#confirm_name").val($("#confirm_wrap").html());
		$("#consult").val("");
		$("#consult_wrap  span").each(function() {
			$("#consult").val($("#consult").val() + $(this).attr("emp_no") + '|');
		})
		$("#consult_name").val($("#consult_wrap").html());

		$("#refer").val("");
		$("#refer_wrap  span").each(function() {
			$("#refer").val($("#refer").val() + $(this).attr("emp_no") + '|');
		})
		$("#refer_name").val($("#refer_wrap").html());

		if ($("#confirm").val().length < 2) {
			alert('请选择审批流程');
			return
		}
		$("#step").val(step);
		editor.sync();
		if (check_form("form_data")) {
			sendForm("form_data", "{:U('save')}");
		}
	}

	function select_confirm() {
		winopen("{:U('popup/confirm')}",730,500);
	};

	$(document).ready(function() {
		$("#confirm span").live("dblclick", function() {
			$("#confirm span").last().find("b").remove();
		});
		$("#consult span").live("dblclick", function() {
			$("#consult span").last().find("b").remove();
		});
		// swfupload

		editor_init();

	}); 
</script>
<div class="title panel panel-default">
	<div class="panel-body">
		<h3 class="col-md-12">编辑:{$flow_type.name}</h3>
	</div>
</div>

<div class="operate panel panel-default">
	<div class="panel-body">
		<div class="pull-left">
			<a onclick="go_return_url();" class="btn btn-default">返回</a>
			<neq name="flow_type.type" value="1">
				<a onclick="popup_confirm();"  class="btn btn-default">选择审批流程</a>
			</neq>
		</div>
		<div class="pull-right">
			<a onclick="save(10);"  class="btn btn-default">临时保存</a>
			<a onclick="save(20);"  class="btn btn-default">提交</a>
		</div>
	</div>
</div>

<form method='post' id="form_data" name="form_data" enctype="multipart/form-data" class="well form-horizontal">
	<input type="hidden" id="id" name="id" value="{$vo.id}">
	<input type="hidden" id="ajax" name="ajax" value="0">
	<input type="hidden" id="add_file" name="add_file" >
	<input type="hidden" id="type" name="type" value="{$flow_type.id}">
	<input type="hidden" id="opmode" name="opmode" value="edit">
	<input type="hidden" id="confirm" name="confirm" value="">
	<input type="hidden" id="confirm_name" name="confirm_name" value="">
	<input type="hidden" id="consult" name="consult" value="">
	<input type="hidden" id="consult_name" name="consult_name" value="">
	<input type="hidden" id="refer" name="refer" value="">
	<input type="hidden" id="refer_name" name="refer_name" value="">
	<input type="hidden" id="step" name="step" value="">
	
		<div class="form-group">
		<label class="col-md-2 control-label" for="name">标题*：</label>
		<div class="col-md-10">
			<input value="{$vo.name}" class="form-control" type="text" id="name" name="name" check="require" msg="请输入标题">
		</div>
	</div>


	<div class="form-group col-md-6">
		<label class="col-md-4 control-label" >文件编号*：</label>
		<div class="col-md-8">
			<p class="form-control-static">
				{$flow_type.doc_no_format}
			</p>
		</div>
	</div>

	<div class="form-group col-md-6">
		<label class="col-md-4 control-label" >日期：</label>
		<div class="col-md-8">
			<p class="form-control-static">
				{$vo.create_time|toDate='Y-m-d'}
			</p>
		</div>
	</div>
	
	<div class="form-group col-md-6">
		<label class="col-md-4 control-label" >编写人：</label>
		<div class="col-md-8">
			<p class="form-control-static">
				{$vo.user_name}
			</p>
		</div>
	</div>		

	<div class="form-group col-md-6">
		<label class="col-md-4 control-label" >部门：</label>
		<div class="col-md-8">
			<p class="form-control-static">
				{$vo.dept_name}
			</p>
		</div>
	</div>		
	
	<div class="form-group">
		<label class="col-md-2 control-label" >裁决：</label>
		<div class="col-md-10">
			<p id="confirm_wrap" class="form-control-static address_list">
				{$vo.dept_name}
			</p>
		</div>
	</div>	
		
	<div class="form-group">
		<label class="col-md-2 control-label" >协商：</label>
		<div class="col-md-10">
			<p id="consult_wrap" class="form-control-static address_list">
				{$vo.consult_name}
			</p>
		</div>
	</div>	

		
	<div class="form-group">
		<label class="col-md-2 control-label" >抄送：</label>
		<div class="col-md-10">
			<p id="refer_wrap" class="form-control-static address_list">
				{$vo.consult_name}
			</p>
		</div>
	</div>	
		
	<div class="form-group">
		<label class="col-md-2 control-label" >附件：</label>
		<div class="col-md-10">
			<include file="Layout:uploader" />
		</div>
	</div>	
	<div class="form-group">
		<div class="col-md-12">
			<textarea id="content" name="content" style="width:100%;height:300px;">{$flow_type.content}</textarea>
		</div>
	</div>
</form>